/*
 * @Author: sdorein sdorein@163.com
 * @Date: 2024-08-02 16:01:06
 * @LastEditors: sdorein sdorein@163.com
 * @LastEditTime: 2024-08-02 16:08:54
 * @FilePath: \vite-ts-project\server\fs.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
// generate-json.ts
import fs from 'fs';

// 定义你想要写入的JSON对象
const data = {
	"pages": [ //pages数组中第一项表示应用启动页，参考：https://uniapp.dcloud.io/collocation/pages
		{
			"path" : "pages/login/login",
			"style" : {
				"navigationStyle": "custom",
				"app-plus": {
					"titleNView": false
				}
			}
		},{
			"path": "pages/index/index",
			"style": {
				"navigationBarTitleText": "首页"
			}
		},
		{
			"path" : "pages/mine/mine",
			"style" : 
			{
				"navigationBarTitleText" : "我的",
				"enablePullDownRefresh" : false
			}
		}
	],
	"tabBar": {
		"color":"#7A7E83",
		"selectedColor":"#f37b1d",
		"list": [
			{
				"text": "首页",
				"pagePath": "pages/index/index",
				"iconPath": "static/home.png",
				"selectedIconPath": "static/homeOn.png"
			},
			{
				"text": "我的",
				"pagePath": "pages/mine/mine",
				"iconPath": "static/mine.png",
				"selectedIconPath": "static/mineOn.png"
			}
		]
	},
	"subPackages": [
		{
			"root": "sub/index",
			"pages": [{
				"path" : "pages/csable/csaCheck",
				"style" :                                                                                    
					{
						"navigationBarTitleText": "物资验收",
						"enablePullDownRefresh": false
					}
			},
			{
				"path" : "pages/csable/csaChecklist",
				"style" : 
				{
					"navigationBarTitleText" : "物资验收信息",
					"enablePullDownRefresh" : false
				}
			},
			{
				"path" : "pages/csable/csaStorlist",
				"style" : 
				{
					"navigationBarTitleText" : "物资入库信息",
					"enablePullDownRefresh" : false
				}
			},
			{
				"path" : "pages/csable/csaStor",
				"style" : 
				{
					"navigationBarTitleText" : "物资入库",
					"enablePullDownRefresh" : false
				}
			},
			{
				"path" : "pages/csable/csaOStorlist",
				"style" : 
				{
					"navigationBarTitleText" : "物资出库信息",
					"enablePullDownRefresh" : false
				}
			},
			{
				"path" : "pages/csable/csaOStor",
				"style" : 
				{
					"navigationBarTitleText" : "物资出库",
					"enablePullDownRefresh" : false
				}
			},
			{
				"path" : "pages/csable/csaTsklist",
				"style" : 
				{
					"navigationBarTitleText" : "物资盘点信息",
					"enablePullDownRefresh" : false
				}
			},
			{
				"path" : "pages/csable/csaTsk",
				"style" : 
				{
					"navigationBarTitleText" : "物资盘点",
					"enablePullDownRefresh" : false
				}
			},{
				"path" : "pages/assets/astCheck",
				"style" :                                                                                    
					{
						"navigationBarTitleText": "资产验收",
						"enablePullDownRefresh": false
					}
			},{
				"path" : "pages/assets/astChecklist",
				"style" : 
				{
					"navigationBarTitleText" : "资产验收信息",
					"enablePullDownRefresh" : false
				}
			},
			{
				"path" : "pages/assets/astTsklist",
				"style" : 
				{
					"navigationBarTitleText" : "资产盘点信息",
					"enablePullDownRefresh" : false
				}
			},
			{
				"path" : "pages/assets/astTsk",
				"style" : 
				{
					"navigationBarTitleText" : "资产盘点",
					"enablePullDownRefresh" : false
				}
			},
			{
				"path" : "pages/assets/astTskShow",
				"style" : 
				{
					"navigationBarTitleText" : "资产明细",
					"enablePullDownRefresh" : false
				}
			}]
		},
		{
			"root": "sub/search",
			"pages": [{
				"path" : "pages/list/list",
				"style" :                                                                                    
					{
						"navigationBarTitleText": "",
						"enablePullDownRefresh": false
					}
			},{
				"path" : "pages/info/info",
				"style" :                                                                                    
					{
						"navigationBarTitleText": "详情",
						"enablePullDownRefresh": false
					}
			}]
		}
	],
	"globalStyle": {
		"navigationBarTextStyle": "black",
		"navigationBarTitleText": "京能",
		"navigationBarBackgroundColor": "#F8F8F8",
		"backgroundColor": "#F8F8F8"
	},
	"uniIdRouter": {}
};

// 将对象转换为JSON字符串
const jsonString = JSON.stringify(data, null, 2); // 第二个参数为null, 第三个参数为2 以便格式化输出

// 写入文件
fs.writeFile('json/pages.json', jsonString, (err) => {
if (err) {
console.error('Error writing file:', err);
return;
}
console.log('File has been written successfully.');
});